class Course:
    def __init__(self):
        self.__name = ''
        self.__credit = 0

    def set_name(self, name):
        self.__name = name

    def set_credit(self, credit):
        if 0 < credit <= 10:
            self.__credit = credit
        else:
            print('Invalid credit value')

    def get_name(self):
        return self.__name

    def get_credit(self):
        return self.__credit


class CourseManage:
    def __init__(self):
        self.__course_list = []

    def add_course(self, course):
        if course not in self.__course_list:
            self.__course_list.append(course)
            print(f'Added {course.get_name()}')
        else:
            print('Course already exists')

    def rm_course(self, course):
        self.__course_list.remove(course)
        print(f'{course.get_name()} removed')

    def show_course_list(self):
        print('current course list:', end='  ')
        for course in self.__course_list:
            print(course.get_name(), end='  ')
            # print('-', course)
        print()

    def cal_credit(self):
        credit = 0
        for i in self.__course_list:
            credit += i.get_credit()
        return credit


if __name__ == '__main__':
    math = Course()
    math.set_name('Math')
    math.set_credit(5)

    english = Course()
    english.set_name('English')
    english.set_credit(3)

    python = Course()
    python.set_name('Python')
    python.set_credit(4)

    manager = CourseManage()
    manager.add_course(math)
    manager.add_course(english)
    manager.add_course(python)
    manager.show_course_list()
    print(manager.cal_credit())

    manager.rm_course(english)
    manager.show_course_list()
    print(manager.cal_credit())
